package com.whnk.pm.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private UserAuthInterceptor userAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(userAuthInterceptor);
        /**
         * 教育经历
         */
        interceptorRegistration.addPathPatterns("/pm/baseInfo/upEdu/*");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/list");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/add/*");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/add");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/edit/*");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/edit");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/detail/*");
        interceptorRegistration.addPathPatterns("/pm/eduInfo/remove");

        /**
         * 工作经历
         */
        interceptorRegistration.addPathPatterns("/pm/baseInfo/upWork/*");
        interceptorRegistration.addPathPatterns("/pm/workInfo/list");
        interceptorRegistration.addPathPatterns("/pm/workInfo/add/*");
        interceptorRegistration.addPathPatterns("/pm/workInfo/add");
        interceptorRegistration.addPathPatterns("/pm/workInfo/edit/*");
        interceptorRegistration.addPathPatterns("/pm/workInfo/edit");
        interceptorRegistration.addPathPatterns("/pm/workInfo/detail/*");
        interceptorRegistration.addPathPatterns("/pm/workInfo/remove");

        /**
         * 项目经历
         */
        interceptorRegistration.addPathPatterns("/pm/baseInfo/upProj/*");
        interceptorRegistration.addPathPatterns("/pm/projInfo/list");
        interceptorRegistration.addPathPatterns("/pm/projInfo/add/*");
        interceptorRegistration.addPathPatterns("/pm/projInfo/add");
        interceptorRegistration.addPathPatterns("/pm/projInfo/edit/*");
        interceptorRegistration.addPathPatterns("/pm/projInfo/edit");
        interceptorRegistration.addPathPatterns("/pm/projInfo/detail/*");
        interceptorRegistration.addPathPatterns("/pm/projInfo/remove");

        /**
         * 附件信息
         */
        interceptorRegistration.addPathPatterns("/pm/baseInfo/upFile/*");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/list");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/add/*");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/add");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/remove");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/dlFile");
        interceptorRegistration.addPathPatterns("/pm/fileInfo/dlFilesForEmp");
    }
}
